import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import { HashRouter as Router, Switch, Route, NavLink, Redirect } from 'react-router-dom'

import './index.scss'
import Today from './today' //引入这两个引入的路由文件
import All from './all'


class Com extends Component {
  render () {
    return (
      <Fragment>
        <header className="course_header">
          <p className="course_header_p">
            {/* 这里跳转的路径必须是当前页面下再进行跳转的 */}
            <NavLink to='/curriculum/today' activeClassName="course_header_p_active">今日
            {/* <span className='course_header_span span2'></span> */}
            </NavLink>
            <NavLink to='/curriculum/all' activeClassName="course_header_p_active">全部
            {/* <span className='course_header_span span2'></span> */}
            </NavLink>
          </p>
        </header>
        <div className="content">
          <div className='box'>
            <Router>
              <Switch>
                <Route path='/curriculum/today' component={Today} />
                <Route path='/curriculum/all' component={All} />
                {/* 默认打开这个页面就显示当前今天的内容 通过这个重定向 */}
                <Redirect path='/curriculum' exact to='/curriculum/today' />
              </Switch>
            </Router>
          </div>
        </div>
      </Fragment>
    )
  }
}
export default connect()(Com)